Skip to content

Add Xcode build system integration with Tier 2 hot-reload#32

Merged
obj-p merged 4 commits intomainfrom
build-system
Mar 21, 2026
Merged

Add Xcode build system integration with Tier 2 hot-reload#32
obj-p merged 4 commits intomainfrom
build-system

Conversation

@obj-p
Copy link
Owner

@obj-p obj-p commented Mar 21, 2026

Summary

  • Adds XcodeBuildSystem implementing the BuildSystem protocol for .xcodeproj projects
  • Detects .xcodeproj by walking up directories, builds via xcodebuild build -configuration Debug -quiet
  • Tier 2 (source compilation + literal hot-reload) via OutputFileMap.json parsing, with Tier 1 fallback
  • Uses -F (framework search path) for compiler flags instead of -I (Xcode produces frameworks)
  • Fixes latent Tier 1 module name bug: bridge dylib now uses PreviewBridge_<name> to avoid self-import error
  • Fails with ambiguousTarget error listing available schemes when multiple exist with no path match
  • Registered in BuildSystemDetector with priority: SPM > Bazel > Xcode
  • 14 new unit tests (detection, scheme picking, build settings parsing, OutputFileMap collection)
  • Updated docs and example README

Test plan

  • swift build compiles
  • swift test — all 69 tests pass (31 in BuildSystem suite)
  • swift-format lint --strict clean
  • Manual integration test with examples/xcode/ via preview_start

Closes #16

🤖 Generated with Claude Code

obj-p and others added 4 commits March 20, 2026 23:41
- XcodeBuildSystem: detect .xcodeproj, build via xcodebuild, parse
  build settings, collect source files from OutputFileMap.json (Tier 2)
  with Tier 1 fallback. Uses -F (framework search path) for compiler flags.
- Fix Tier 1 module name bug: bridge dylib now uses PreviewBridge_<name>
  to avoid "file is part of module X; ignoring import" self-import error.
- Fail with ambiguousTarget error when multiple schemes exist and none
  match the source file path, listing available schemes for the user.
- Register in BuildSystemDetector (priority: SPM > Bazel > Xcode)
- Add 14 unit tests for detection, scheme picking, build settings
  parsing, search paths parsing, OutputFileMap collection, and detector
  priority.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- parseBuildSettings: stop at second "Build settings for" header to
  avoid conflating settings from multiple targets in the same scheme
- Remove unused ProjectInfo.targets field
- Verify BUILT_PRODUCTS_DIR exists instead of assuming .framework
  product type (supports app targets, static libraries, etc.)
- Simplify parseSearchPaths to basic split + quote strip + filter
- Use Set for deduplicating framework search paths
- Rename misleading test, add multi-target parsing test

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Anticipates future examples/xcworkspace directory for workspace
support (#34). Updates all references in skills, READMEs, and docs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@obj-p obj-p enabled auto-merge (squash) March 21, 2026 03:43
@obj-p obj-p merged commit 7491dbb into main Mar 21, 2026
2 checks passed
@obj-p obj-p deleted the build-system branch March 21, 2026 03:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Xcode build system integration (.xcodeproj)

1 participant